//Accepted
#include <cstdio>

int n, m, i, j, k, l;
char t[100][101];
bool vai;
int main(){
        //freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
        scanf("%d %d", &n, &m);
        for(i=0;i<n;i++)scanf("%s", t[i]);
        for(i=0;i<n;i++){
                for(j=0;j<m;j++){
						vai=true;
                        for(k=0;k<n;k++){if(k==i)continue;if(t[k][j]==t[i][j]){vai=false;break;}}
                        for(l=0;l<m;l++){if(l==j)continue;if(t[i][l]==t[i][j]){vai=false;break;}}
						if(vai)printf("%c", t[i][j]);
                }
        }
        return 0;
}
